<template>
  <div class="tarbar">
    <!-- 使用vue中的keep-alive 标签包裹实现缓存 不必返回之前的路由还要再次刷新
          这里的容器只控制他的子路由在切换时的缓存-->
    <keep-alive>
      <router-view />
    </keep-alive>
    <van-tabbar v-model="active" route>
      <van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
      <van-tabbar-item icon="search">问答</van-tabbar-item>
      <van-tabbar-item icon="friends-o">视频</van-tabbar-item>
      <van-tabbar-item icon="setting-o" to="/my">{{$store.state.user ? '我的' : '未登录'}}</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'tabPage',
  data () {
    return {
      active: 0
    }
  }
}
</script>

<style>

</style>
